package com.hnevc.mallserver3.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnevc.mallserver3.dto.CartDTO;
import com.hnevc.mallserver3.entity.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface CartMapper extends BaseMapper<Cart> {

    @Select("SELECT c.id, g.goods_name, g.price, c.quantity, g.icon, c.selected " +
            "FROM t_cart c " +
            "JOIN t_goods g ON c.goods_id = g.id " +
            "WHERE c.member_id = #{memberId}")
    List<CartDTO> selectCartItemsByMemberId(Long memberId);
}